feat: implement WithMetadataKey filter across all backends#23
Merged
Conversation
SQLite uses json_each to match key-value pairs in the metadata column. MongoDB appends dot-notation filters on the metadata subdocument. ClickHouse uses JSONExtractString for key lookup. The proto ReadOptions message gains a metadata_filters map<string,string> field (field 7). The ledgerpb adapter translates map entries to WithMetadataKey calls so the gRPC/HTTP gateway surfaces the same filter. Conformance test added to storetest covering single-key filter, AND of two keys, and non-matching value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
json_each(metadata)to match key-value pairs, consistent with the existing tag filter patternmetadata.<key> = valuedot-notation filters to the BSON queryJSONExtractString(metadata, key) = valuemap<string,string> metadata_filters(field 7) toReadOptions; regeneratedapi/ledger/v1/ledger.pb.goReadOptionsstruct gainsMetadataFilters map[string]string;readOptionsFromProtoandcommonOpts()wired upWithMetadataKeyFilterconformance test covering single-key, AND of two keys, and no-match casesPostgreSQL already supported this filter via
metadata @> $N::jsonb(added in a prior PR).Test plan
go test -race ./...— all packages passgolangci-lint run ./...— 0 issues